package org.ym.thread.ui.payload;

import lombok.Data;
import org.ym.thread.application.command.ThreadPoolUpdateCommand;

import java.io.Serializable;

/**
 * @author ym
 */
@Data
public class ThreadPoolUpdatePayload implements Serializable {
    private static final long serialVersionUID = 7531267498498305444L;
    /**
     * threadKey
     */
    private Long key;
    /**
     * 核心线程数
     */
    private Integer corePoolSize;
    /**
     * 最大线程数
     */
    private Integer maximumPoolSize;
    /**
     * 线程任务缓存队列长度
     */
    private Integer queueSize;

    /**
     * 转换命令
     * @return
     */
    public ThreadPoolUpdateCommand toCommand(){
        return ThreadPoolUpdateCommand.builder()
                .corePoolSize(corePoolSize)
                .key(key)
                .maximumPoolSize(maximumPoolSize)
                .queueSize(queueSize)
                .build();
    }
}
